{{ define "main" }}
<main class="content-page container pt-7 pb-5">
    {{ $page := . }}
    <div class="row">
        <div class="col">
            <article>
                <div class="row justify-content-center">
                    <div class="col-lg-8">
                        <div class="meta text-muted mb-3">
                            <p class="created text-muted text-uppercase font-weight-bold mb-1">{{ $page.Date.Format (.Site.Params.dateFormat | default "January 2, 2006") }}</p>
                            <span class="mr-2"><i class="fas fa-book-open mr-2"></i>{{ T "wordCount" $page.WordCount }}</span>
                            <span><i class="fas fa-clock mr-2"></i>{{ T "readingTime" $page.ReadingTime }}</span>
                        </div>

                        <h1>{{ $page.Title }}</h1>

                        {{ partial "authors.html" $page }}
                    </div>
                </div>

                {{- with $page.Params.images -}}
                    {{- $images := . -}}
                    {{- with $page.Site.GetPage "section" "images" -}}
                        {{- with .Resources.GetMatch (strings.TrimPrefix "/images/" (index $images 0)) -}}
                            {{- $image := .Fit "900x500" -}}
                            <div class="row justify-content-center mb-3">
                                <div class="col-lg-10">
                                    <img data-src="{{ $image.RelPermalink }}" class="img-fluid rounded mx-auto d-block" alt="{{ $page.Title }}">
                                </div>
                            </div>
                        {{- end -}}
                    {{- end -}}
                {{- end -}}

                <div class="row justify-content-center">
                    <div class="col-lg-8">
                        <div class="content">
                            {{ $page.Content }}
                        </div>

                        {{- with $page.Params.tags -}}
                            <div class="tags my-3">
                            {{- range . -}}
                                <a class="badge badge-pill badge-light border mr-2" href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">
                                    <i class="fas fa-tag mr-2"></i>{{ . }}
                                </a>
                            {{- end -}}
                            </div>
                        {{- end -}}

                        {{ partial "sharer.html" . }}
                    </div>
                </div>

                <div class="row justify-content-center">
                    <div class="col-lg-8">
                        {{ template "_internal/disqus.html" . }}
                    </div>
                </div>

                {{- if .Site.Params.commento.enable -}}
                <div class="row justify-content-center my-3">
                    <div class="col-lg-8">
                        <div id="commento"></div>
                        <script src="{{ .Site.Params.commento.url }}"></script>
                    </div>
                </div>
                {{- end -}}
            </article>
        </div>
    </div>

    {{ partial "related.html" $page }}
</main>
{{ end }}
